import json

from flask import Blueprint, request
from app.Controllers.BaseController import BaseController
from app.Package.entity.PCARequestBody import PCARequestBody
from app.Service.ChemometricsTutorialsServices.PCAService import getPCAScorePlot, getPCAScreePlot, getPCACvPlot, getPCADmodxPlot, getPCAOutlier, \
    PCACommonProcess
from app.Service.ChemometricsTutorialsServices.CommonService import getProjectInfo

pca = Blueprint('pca', __name__)


@pca.route('/')
def index():
    return BaseController().successData(msg="it's PCA")

@pca.route('/getPCAScorePlot', methods=['POST'])
def PCAScorePlot():
    PCA = PCACommonProcess()
    result = getPCAScorePlot(PCA)
    return result

@pca.route('/getPCAScreePlot', methods=['POST'])
def PCAScreePlot():
    PCA = PCACommonProcess()
    result = getPCAScreePlot(PCA)
    return result

@pca.route('/getPCACvPlot', methods=['POST'])
def PCACvPlot():
    PCA = PCACommonProcess()
    result = getPCACvPlot(PCA)
    return result

@pca.route('/getPCADmodxPlot', methods=['POST'])
def PCADmodxPlot():
    PCA = PCACommonProcess()
    result = getPCADmodxPlot(PCA)
    return result

@pca.route('/getPCAOutlier', methods=['POST'])
def PCAOutlier():
    PCA = PCACommonProcess()
    result = getPCAOutlier(PCA)
    return result